<!DOCTYPE html>

<style>
    /* Must be positioned absolute or static, must have margins to push it out view. */
    .positioned {
        position: absolute;
        margin-top: 100%;
    }

    /* Any kind of quote will do, can be either :before or :after */
    .positioned:before,
    .focusable:before {
        content: open-quote;
    }
</style>

<p>Bug 109616 - ASSERT(!layoutObject()->needsLayout()) when calling Element::focus() with generated content</p>

<!--
    This is testing a case where LayoutQuote (anonymous)::updateDepth would mark the LayoutQuote (anonymous)
    and its ancestors as needing layout in the middle of a layout of its ancestor.
    When its ancestor finishes the layout it will mark itself and the ancestors
    farther up as no longer needing layout. The end result is some subtree
    needing layout, but the LayoutView and possibly other ancestors of the subtree
    not needing layout.

    ex.

    LayoutView <- !needsLayout
        \
       LayoutBlockFlow (.focusable) <- needsLayout
            \
             LayoutBlockFlow (generated content) <- needsLayout
                \
                 LayoutQuote (anonymous) <- needsLayout
-->

<div class="positioned"></div>
<div class="focusable" tabindex="1"></div>

<script>
    if (window.testRunner)
        testRunner.dumpAsText();
    // .focusable still needs layout at this point, but LayoutView doesn't
    // think any descendants need layout.
    document.querySelector('.focusable').focus();
</script>
